<template class='body'>
  <van-row class="main-menu">
    <van-nav-bar left-text="返回" title="单位导入" @click-left="doBack" />
    <el-row class="main">
      <div class="maincontainer">
        <el-row class="main-menu">
          <el-col :span="24" class="" style="padding:10px 10px 0 10px;">

            <!-- <a href="#" @click="dsad">下载模板</a> -->
            <a class="topbutton" href="/aj/excel/dwmb.xlsx"><el-button size="small" type="primary" icon="el-icon-document">
                下载单位模板
            </el-button></a>

            <!-- 添加数据 -->
            <el-button size="small" class="el-icon-plus topbutton" type="success" @click="tableRowClassName('','','addUser')" plain>添加数据</el-button>
            <el-upload
              class="upload-demo topbutton"
              action=""
              :on-change="uploadExcel"
              :on-remove="handleRemove"
              accept=".xlsx"
              :auto-upload="false"
              :show-file-list="false"
              :show-overflow-tooltip="true"
            >            
              <el-button type="success" size="small" icon="el-icon-folder-add">
                Excel导入
              </el-button>
            </el-upload>
            <!-- 查看临时数据 -->
            <el-button type="success" size="small" @click="LookLsdata = true" plain>查看临时数据</el-button>
            <!-- excel错误通知 -->
            <!-- <el-button type="success" @click="handleRemove">清空</el-button> -->

          </el-col>
        </el-row>
        <el-row class="main-table">
          <el-col :span="24">
            <el-table
              v-loading="loading"
              ref="multipleTable"
              width="140"
              :indeterminate="isIndeterminate"
              v-model="checkAll"
              @selection-change="handleSelectionChange"
              :data="tableData"
              :row-style="{ height: '80px', maxHeight: '100px' }"
              class="etable"
              stripe
              border
              empty-text="临时数据表,没有数据"
              align="center"
              fit
            >
              <el-table-column fixed="left" align="center" label="操作" width="100">
                <template slot-scope="scope">
                  <el-button type="primary" size="mini" icon="el-icon-edit" @click="tableRowClassName(scope.row,scope.$index,'editUser')" circle></el-button>
                  <el-button type="danger" size="mini" icon="el-icon-delete" @click="RemoveExceldata(scope.row, scope.$index)" circle></el-button>
                </template>
                
              </el-table-column>
              <!-- 排序 -->
              <el-table-column
                fixed="left"
                prop="px"
                label="排序"
                width="50"
                align="center"
              >
                <template slot-scope="scope">
                  <div :id="'page'+(scope.$index + 1)" :class='["baocuohong",scope.row.pxxh=="cuowu" ? "red" : "",scope.row.chongfu=="chongfu" ? "org" : "",scope.row.isover=="1" ? "org" : ""]'>
                    {{ scope.$index + 1 }}
                  </div>
                </template>
              </el-table-column>
            <!--全选和单选-->
            <el-table-column type="selection" :selectable='checkboxT' min-width="6%">
            </el-table-column>
              <!-- 账号 (提单人) -->
              <!-- <el-table-column
                prop="personName"
                label="账号 (提单人)"
                width="140"
                align="center"
              >
              </el-table-column> -->

              <!-- 序号 -->
              <el-table-column
                prop="xh"
                label="序号"
                width="100"
                align="center"
              > 
              </el-table-column>

              <!-- 问题发现方式 -->
              <el-table-column
                prop="wtfxfs"
                label="问题发现方式"
                width="100"
                align="center"
              >
              </el-table-column>

              <el-table-column
                prop="dwmc"
                label="单位名称"
                width="100"
                align="center"
              >
              </el-table-column>

              <!-- 部门名称 -->
              <el-table-column
                prop="bmmc"
                label="部门名称"
                width="100"
                align="center"
              >
              </el-table-column>

              <!-- 专业类别 -->
              <el-table-column
                prop="zylb"
                label="专业类别"
                width="100"
                align="center"
              >
              </el-table-column>

              <!-- 业务事项 -->
              <el-table-column
                prop="ywsx"
                label="业务事项（考核载体）"
                align="center"
                width="100"
              >
              </el-table-column>

              <!-- 问题描述 -->
              <el-table-column
                prop="wtms"
                label="问题描述"
                width="260"
                header-align="center"
              >
              </el-table-column>

              <!-- 根本原因 -->
              <el-table-column
                prop="gbyy"
                label="根本原因"
                width="260"
                align="center"
              >
              </el-table-column>

              <!-- 所属层面 -->
              <el-table-column
                prop="sscm"
                label="所属层面"
                width="100"
                align="center"
              >
              </el-table-column>

              <!-- 管理环节 -->
              <el-table-column
                prop="glhj"
                label="管理环节"
                width="100"
                header-align="left"
              >
              </el-table-column>

              <!-- 问题类别 -->
              <el-table-column
                prop="wtlb"
                label="问题类别"
                width="100"
                header-align="left"
              >
              </el-table-column>

              <!-- 对应体系单元 -->
              <el-table-column
                prop="dytxdy"
                label="对应体系单元"
                width="100"
                align="center"
              >
              </el-table-column>

              <!-- 对应体系要素 -->
              <el-table-column
                prop="dytxys"
                label="对应体系要素"
                width="100"
                align="center"
              >
              </el-table-column>

              <!-- 问题严重程度 -->
              <el-table-column
                prop="wtyzcd"
                label="问题严重程度"
                width="100"
                align="center"
              >
              </el-table-column>

              <!-- 是否三老问题 -->
              <el-table-column
                prop="sfslwt"
                label="是否三老问题"
                width="100"
                align="center"
              >
              </el-table-column>

              <!--是否主动暴露  -->
              <el-table-column
                prop="sfzdbl"
                label="是否主动暴露"
                width="100"
                align="center"
              >
              </el-table-column>

              <!-- 整改建议 -->
              <el-table-column
                prop="zgjy"
                label="整改建议"
                width="260"
                align="center"
              >
              </el-table-column>

              <!-- 发现时间 -->
              <el-table-column
                prop="wtfxsj"
                label="问题发现时间"
                width="100"
                align="center"
              >
              </el-table-column>

              <!-- 问题发现人 -->
              <el-table-column
                prop="wtfxr"
                label="问题发现人"
                width="100"
                align="center"
              >
              </el-table-column>

              <!-- 各单位考核部门 -->
              <el-table-column
                prop="gdwkhbm"
                label="各单位考核部门"
                width="100"
                align="center"
              >
              </el-table-column>

                <!-- 问题责任人 -->
              <el-table-column
                prop="fzr"
                label="问题责任人"
                width="100"
                align="center"
              >
              </el-table-column>

              <!-- <el-table-column fixed="right" label="操作" width="100">
                <template slot-scope="scope">
                  <el-button type="primary" size="mini" icon="el-icon-edit" @click="tableRowClassName(scope.row,scope.$index,'editUser')" circle></el-button>
                  <el-button type="danger" size="mini" icon="el-icon-delete" @click="RemoveExceldata(scope.row, scope.$index)" circle></el-button>
                </template>
                
              </el-table-column> -->
              <!-- 表格内容 -->

            </el-table>
          </el-col>
        </el-row>
        <el-row class="main-menu main-submit" type="flex" justify="center">
          <el-col :span="6" class="col">
              <el-button type="danger" @click="BatchDelete()">批量删除</el-button>
              <el-button type="primary" @click="CheckFfdata()">检查</el-button>
              <el-button type="primary" @click="AllDialogsaveData()" :disabled="disabled">保存到临时数据</el-button>
            <!-- <template slot-scope="scope">
                <el-button type="primary" :disabled='scope.row.chongfu == "chongfu" ? "true" : "" && scope.row.pxxh == "cuowu" ? "true" : ""'  @click="AllDialogsaveData()">全部保存</el-button>
            </template> -->
            <!-- <el-button type="primary" @click="SendData()">提交</el-button> -->
          </el-col>
        </el-row>

        <!-- 编辑和添加数据弹框 -->
      <el-dialog
          :title="this.allTypemode == 'addUser' ? '添加信息' : '编辑信息'"
          :visible.sync="editdialogVisible"
          width="80%"
          >
          <div>
          <el-form :inline="false" :model="this.allTypemode == 'addUser' ? userInfo : editObj" class="" label-width="150px">
            <el-form-item label="账号（提单人）">
              <el-input v-model="userInfo.personName" v-if="this.allTypemode == 'addUser'"></el-input>
              <el-input v-model="editObj.personName" v-if="this.allTypemode == 'editUser'"></el-input>
            </el-form-item>
            <el-form-item label="序号">
                <el-input v-model="userInfo.xh" v-if="this.allTypemode == 'addUser'"></el-input>
                <el-input v-model="editObj.xh" v-if="this.allTypemode == 'editUser'"></el-input>
            </el-form-item>
            <el-form-item label="问题发现方式">
                <el-select size="small" 
                  v-model="userInfo.wtfxfs" 
                  placeholder="请选择" 
                  v-if="this.allTypemode == 'addUser'"
                  filterable
                  allow-create
                  default-first-option
                >
                  <el-option
                    v-for="(item, i) in options.wtfxfs"
                    :key="i"
                    :value="item"
                    :title="item"
                  ></el-option>
                </el-select>
                <el-select size="small"
                v-model="editObj.wtfxfs" 
                placeholder="请选择" 
                v-if="this.allTypemode == 'editUser'"
                filterable
                allow-create
                default-first-option
                >
                  <el-option
                    v-for="(item, i) in options.wtfxfs"
                    :key="i"
                    :value="item"
                    :title="item"
                  ></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="单位名称">
              <el-select size="small" v-model="userInfo.dwmc" placeholder="请选择" v-if="this.allTypemode == 'addUser'">
                  <el-option
                    v-for="(item, i) in options.dwmc"
                    :key="i"
                    :value="item"
                    :title="item"
                  ></el-option>
                </el-select>
                <el-select size="small" v-model="editObj.dwmc" placeholder="请选择" v-if="this.allTypemode == 'editUser'">
                  <el-option
                    v-for="(item, i) in options.dwmc"
                    :key="i"
                    :value="item"
                    :title="item"
                  ></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="部门名称">
              <el-select size="small" v-model="userInfo.bmmc" placeholder="请选择" v-if="this.allTypemode == 'addUser'">
                  <el-option
                    v-for="(item, i) in options.bmmc"
                    :key="i"
                    :value="item"
                    :title="item"
                  ></el-option>
                </el-select>
                <el-select size="small" v-model="editObj.bmmc" placeholder="请选择" v-if="this.allTypemode == 'editUser'">
                  <el-option
                    v-for="(item, i) in options.bmmc"
                    :key="i"
                    :value="item"
                    :title="item"
                  ></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="专业类别">
              <el-select size="small" v-model="userInfo.zylb" placeholder="请选择" v-if="this.allTypemode == 'addUser'">
                <el-option
                  v-for="(item, i) in options.zylb"
                  :key="i"
                  :value="item"
                  :title="item"
                ></el-option>
              </el-select>
              <el-select size="small" v-model="editObj.zylb" placeholder="请选择" v-if="this.allTypemode == 'editUser'">
                <el-option
                  v-for="(item, i) in options.zylb"
                  :key="i"
                  :value="item"
                  :title="item"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="业务事项（考核载体）">
              <el-select size="small" v-model="userInfo.ywsx" placeholder="请选择" v-if="this.allTypemode == 'addUser'">
                <el-option
                  v-for="(item, i) in options.ywsx"
                  :key="i"
                  :value="item"
                  :title="item"
                ></el-option>
              </el-select>
              <el-select size="small" v-model="editObj.ywsx" placeholder="请选择" v-if="this.allTypemode == 'editUser'">
                <el-option
                  v-for="(item, i) in options.ywsx"
                  :key="i"
                  :value="item"
                  :title="item"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="问题描述">
                <el-input v-model="userInfo.wtms" v-if="this.allTypemode == 'addUser'"></el-input>
                <el-input v-model="editObj.wtms" v-if="this.allTypemode == 'editUser'"></el-input>
            </el-form-item>
            <el-form-item label="根本原因">
              <el-input v-model="userInfo.gbyy" v-if="this.allTypemode == 'addUser'"></el-input>
              <el-input v-model="editObj.gbyy" v-if="this.allTypemode == 'editUser'"></el-input>
            </el-form-item>
            <el-form-item label="所属层面">
              <el-select size="small" v-model="userInfo.sscm" placeholder="请选择" v-if="this.allTypemode == 'addUser'">
                  <el-option
                    v-for="(item, i) in options.sscm"
                    :key="i"
                    :value="item"
                    :title="item"
                  ></el-option>
              </el-select>
              <el-select size="small" v-model="editObj.sscm" placeholder="请选择" v-if="this.allTypemode == 'editUser'">
                  <el-option
                    v-for="(item, i) in options.sscm"
                    :key="i"
                    :value="item"
                    :title="item"
                  ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="管理环节">
              <el-select size="small" v-model="userInfo.glhj" placeholder="请选择" v-if="this.allTypemode == 'addUser'">
                <el-option
                  v-for="(item, i) in options.glhj"
                  :key="i"
                  :value="item"
                  :title="item"
                ></el-option>
              </el-select>
              <el-select size="small" v-model="editObj.glhj" placeholder="请选择" v-if="this.allTypemode == 'editUser'">
                <el-option
                  v-for="(item, i) in options.glhj"
                  :key="i"
                  :value="item"
                  :title="item"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="问题类别">
              <el-select size="small" v-model="userInfo.wtlb" placeholder="请选择" v-if="this.allTypemode == 'addUser'">
                <el-option
                  v-for="(item, i) in options.wtlb"
                  :key="i"
                  :value="item"
                  :title="item"
                ></el-option>
              </el-select>
              <el-select size="small" v-model="editObj.wtlb" placeholder="请选择" v-if="this.allTypemode == 'editUser'">
                <el-option
                  v-for="(item, i) in options.wtlb"
                  :key="i"
                  :value="item"
                  :title="item"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="对应体系单元">
              <el-select size="small" v-model="userInfo.dytxdy" placeholder="请选择" v-if="this.allTypemode == 'addUser'">
                <el-option
                  v-for="(item, i) in options.dytxdy"
                  :key="i"
                  :value="item"
                  :title="item"
                ></el-option>
              </el-select>
              <el-select size="small" v-model="editObj.dytxdy" placeholder="请选择" v-if="this.allTypemode == 'editUser'">
                <el-option
                  v-for="(item, i) in options.dytxdy"
                  :key="i"
                  :value="item"
                  :title="item"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="对应体系要素">
              <el-select size="small" v-model="userInfo.dytxys" placeholder="请选择" v-if="this.allTypemode == 'addUser'">
                  <el-option
                    v-for="(item, i) in options.dytxys"
                    :key="i"
                    :value="item"
                    :title="item"
                  ></el-option>
                </el-select>
                <el-select size="small" v-model="editObj.dytxys" placeholder="请选择" v-if="this.allTypemode == 'editUser'">
                  <el-option
                    v-for="(item, i) in options.dytxys"
                    :key="i"
                    :value="item"
                    :title="item"
                  ></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="问题严重程度">
                <el-select size="small" v-model="userInfo.wtyzcd" placeholder="请选择" v-if="this.allTypemode == 'addUser'">
                  <el-option
                    v-for="(item, i) in options.wtyzcd"
                    :key="i"
                    :value="item"
                    :title="item"
                  ></el-option>
                </el-select>
                <el-select size="small" v-model="editObj.wtyzcd" placeholder="请选择" v-if="this.allTypemode == 'editUser'">
                  <el-option
                    v-for="(item, i) in options.wtyzcd"
                    :key="i"
                    :value="item"
                    :title="item"
                  ></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="是否三老问题">
                <el-select size="small" v-model="userInfo.sfslwt" placeholder="请选择" v-if="this.allTypemode == 'addUser'">
                  <el-option
                    v-for="(item, i) in options.sfslwt"
                    :key="i"
                    :value="item"
                    :title="item"
                  ></el-option>
                </el-select>
                  <el-select size="small" v-model="editObj.sfslwt" placeholder="请选择" v-if="this.allTypemode == 'editUser'">
                  <el-option
                    v-for="(item, i) in options.sfslwt"
                    :key="i"
                    :value="item"
                    :title="item"
                  ></el-option>
                </el-select>
            </el-form-item>
            <el-form-item label="是否主动暴露">
              <el-select size="small" v-model="userInfo.sfzdbl" placeholder="请选择" v-if="this.allTypemode == 'addUser'">
                <el-option
                  v-for="(item, i) in options.sfzdbl"
                  :key="i"
                  :value="item"
                  :title="item"
                ></el-option>
              </el-select>
              <el-select size="small" v-model="editObj.sfzdbl" placeholder="请选择" v-if="this.allTypemode == 'editUser'">
                <el-option
                  v-for="(item, i) in options.sfzdbl"
                  :key="i"
                  :value="item"
                  :title="item"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="整改建议">
              <el-input v-model="userInfo.zgjy" v-if="this.allTypemode == 'addUser'"></el-input>
              <el-input v-model="editObj.zgjy" v-if="this.allTypemode == 'editUser'"></el-input>
            </el-form-item>
            <el-form-item label="问题发现时间">
              <el-date-picker
                  v-model="userInfo.wtfxsj"
                  type="date"
                  v-if="this.allTypemode == 'addUser'"
                  :picker-options="pickerOptions0"
                  placeholder="选择日期"
                  format="yyyy 年 MM 月 dd 日"
                  value-format="yyyy-MM-dd"
                >
                </el-date-picker>
                <el-date-picker
                  v-model="editObj.wtfxsj"
                  type="date"
                  v-if="this.allTypemode == 'editUser'"
                  :picker-options="pickerOptions0"
                  placeholder="选择日期"
                  format="yyyy 年 MM 月 dd 日"
                  value-format="yyyy-MM-dd"
                >
                </el-date-picker>
            </el-form-item>
            <el-form-item label="问题发现人">
              <el-input v-model="userInfo.wtfxr" v-if="this.allTypemode == 'addUser'"></el-input>
              <el-input v-model="editObj.wtfxr" v-if="this.allTypemode == 'editUser'"></el-input>
            </el-form-item>
            <el-form-item label="各单位考核部门">
              <el-select size="small" v-model="userInfo.gdwkhbm" placeholder="请选择" v-if="this.allTypemode == 'addUser'">
                <el-option
                  v-for="(item, i) in options.gdwkhbm"
                  :key="i"
                  :value="item"
                  :title="item"
                ></el-option>
              </el-select>
                <el-select size="small" v-model="editObj.gdwkhbm" placeholder="请选择" v-if="this.allTypemode == 'editUser'">
                <el-option
                  v-for="(item, i) in options.gdwkhbm"
                  :key="i"
                  :value="item"
                  :title="item"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="问题责任人">
              <el-input v-model="userInfo.fzr" v-if="this.allTypemode == 'addUser'"></el-input>
              <el-input v-model="editObj.fzr" v-if="this.allTypemode == 'editUser'"></el-input>
            </el-form-item>
          </el-form>
          </div>
          <span slot="footer" class="dialog-footer">
            <el-button @click="editdialogVisible = false">取 消</el-button>
            <el-button type="primary" @click="editconFirm" v-if="this.allTypemode == 'editUser'">确定修改</el-button>
            <el-button type="primary" @click="addUserconFirm" v-if="this.allTypemode == 'addUser'">确定添加</el-button>
          </span>
        </el-dialog>

      <!-- 查看临时数据弹框 -->
        <el-dialog
          title="临时数据"
          :visible.sync="LookLsdata"
          width="95%"
          >
          <div class="LookDataBiao">    
            <div class="multiplposition">点击"提交到正式库"后,问题将发送至安监部（注："公司层面的发送到公司安监部"，"非公司层面发送到单位所属的安监部"）</div>
            <el-row class="main-table">
              <el-col :span="24">
                <el-table
                  ref="multipleTable"
                  v-loading="temloading"
                  width="140"
                  :indeterminate="isIndeterminate"
                  v-model="checkAll"
                  @selection-change="LinshiSelectionChange"
                  :data="multipleSelections"
                  :row-style="{ height: '80px', maxHeight: '100px' }"
                  class="etable"
                  stripe
                  border
                  empty-text="临时数据表,没有数据"
                  align="center"
                  fit
                >
                          <!-- 排序 -->
              <el-table-column
                prop="px"
                label="排序"
                width="50"
                align="center"
              >
                <template slot-scope="scope">
                  <div :class='["baocuohong",scope.row.isover=="1" ? "org" : ""]'>
                    {{ scope.$index + 1 }}
                  </div>
                </template>
              </el-table-column>
                <!--全选和单选-->
                <el-table-column type="selection" :selectable='checkboxT' min-width="6%">
                </el-table-column>
                  <!-- 账号 (提单人) -->
                  <el-table-column
                    prop="personName"
                    label="账号 (提单人)"
                    width="140"
                    align="center"
                  >
                  </el-table-column>

                  <!-- 序号 -->
                  <el-table-column
                      prop="xh"
                      label="序号"
                      width="100"
                      align="center"
                    >
                  </el-table-column>

                  <!-- 问题发现方式 -->
                  <el-table-column
                    prop="wtfxfs"
                    label="问题发现方式"
                    width="160"
                    align="center"
                  >
                  </el-table-column>

                  <el-table-column
                    prop="dwmc"
                    label="单位名称"
                    width="234"
                    align="center"
                  >
                  </el-table-column>

                  <!-- 部门名称 -->
                  <el-table-column
                    prop="bmmc"
                    label="部门名称"
                    width="285"
                    align="center"
                  >
                  </el-table-column>

                  <!-- 专业类别 -->
                  <el-table-column
                    prop="zylb"
                    label="专业类别"
                    width="150"
                    align="center"
                  >
                  </el-table-column>

                  <!-- 业务事项 -->
                  <el-table-column
                    prop="ywsx"
                    label="业务事项（考核载体）"
                    align="center"
                    width=""
                    min-width="190"
                  >
                  </el-table-column>

                  <!-- 问题描述 -->
                  <el-table-column
                    prop="wtms"
                    label="问题描述"
                    min-width="190"
                    header-align="center"
                  >
                  </el-table-column>

                  <!-- 根本原因 -->
                  <el-table-column
                    prop="gbyy"
                    label="根本原因"
                    width="200"
                    align="center"
                  >
                  </el-table-column>

                  <!-- 所属层面 -->
                  <el-table-column
                    prop="sscm"
                    label="所属层面"
                    width="160"
                    align="center"
                  >
                  </el-table-column>

                  <!-- 管理环节 -->
                  <el-table-column
                    prop="glhj"
                    label="管理环节"
                    width="160"
                    header-align="left"
                  >
                  </el-table-column>

                  <!-- 问题类别 -->
                  <el-table-column
                    prop="wtlb"
                    label="问题类别"
                    width="160"
                    header-align="left"
                  >
                  </el-table-column>

                  <!-- 对应体系单元 -->
                  <el-table-column
                    prop="dytxdy"
                    label="对应体系单元"
                    width="200"
                    align="center"
                  >
                  </el-table-column>

                  <!-- 对应体系要素 -->
                  <el-table-column
                    prop="dytxys"
                    label="对应体系要素"
                    width="150"
                    align="center"
                  >
                  </el-table-column>

                  <!-- 问题严重程度 -->
                  <el-table-column
                    prop="wtyzcd"
                    label="问题严重程度"
                    width="136"
                    align="center"
                  >
                  </el-table-column>

                  <!-- 是否三老问题 -->
                  <el-table-column
                    prop="sfslwt"
                    label="是否三老问题"
                    width="130"
                    align="center"
                  >
                  </el-table-column>

                  <!--是否主动暴露  -->
                  <el-table-column
                    prop="sfzdbl"
                    label="是否主动暴露"
                    width="130"
                    align="center"
                  >
                  </el-table-column>

                  <!-- 整改建议 -->
                  <el-table-column
                    prop="zgjy"
                    label="整改建议"
                    width="190px"
                    align="center"
                  >
                  </el-table-column>

                  <!-- 发现时间 -->
                  <el-table-column
                    prop="wtfxsj"
                    label="问题发现时间"
                    width="260"
                    align="center"
                  >
                  </el-table-column>

                  <!-- 问题发现人 -->
                  <el-table-column
                    prop="wtfxr"
                    label="问题发现人"
                    width="120"
                    align="center"
                  >
                  </el-table-column>

                  <!-- 各单位考核部门 -->
                  <el-table-column
                    prop="gdwkhbm"
                    label="各单位考核部门"
                    width="100"
                    align="center"
                  >
                  </el-table-column>

                  <!-- 问题责任人 -->
                  <el-table-column
                    prop="fzr"
                    label="问题责任人"
                    width="100"
                    align="center"
                  >
                  </el-table-column>

                  <el-table-column fixed="right" label="操作" width="50">
                    <template slot-scope="scope">
                      <!-- <el-button
                          align="center"
                          type="warning"
                          size="small"
                          @click="XgDaoruedit(scope.row, scope.$index)"
                          >修改</el-button
                          
                        > -->
                      <!-- <el-button
                        align="center"
                        type="danger"
                        size="small"
                        @click="Removedata(scope.row, scope.$index)"
                        >删除</el-button
                      > -->
                      <el-button type="danger" size="mini" icon="el-icon-delete" @click="Removedata(scope.row, scope.$index)" circle></el-button>
                    </template>
                  </el-table-column>
                  <!-- 表格内容 -->

                </el-table>
              </el-col>
              </el-row>
              <el-row class="main-menu main-submit" type="flex" justify="end">
                <el-col :span="6" class="col">
                  <el-button type="danger" @click="temporaryBatchDelete()">批量删除</el-button>
                  <el-button type="primary" size="small" @click="SendData()">提交到正式库</el-button>
                </el-col>
            </el-row>
          </div>
          <span slot="footer" class="dialog-footer">
            <el-button @click="LookLsdata = false">取 消</el-button>
            <!-- <el-button type="primary" @click="LookLsdata = false">确 定</el-button> -->
          </span>
        </el-dialog>
      </div>
    </el-row>
  </van-row>
</template>



<script>
import Vue from 'vue'
import axios from 'axios'
/* 下拉框的 默认值 */
import {wtfxfs,dwmc,bmmc,zylb,ywsx,dwsscm,dytxys,dytxdy,wtyzcd,gdwkhbm,glhj,wtlb,} from "../../utils/excel/option";
/* 交互api */
import {dwmoban,getThisIdList,uploadformal,uploadtemporary,UpdateByid,deleteList,batchdeleteList} from "../../api/uploadTable";
import { Loading } from 'element-ui';
import {export_json_to_excell} from '../../../public/excel/Export2Excel';
export default {
  data() {
    return {
      pickerOptions0: {
        disabledDate(time) {
          return time.getTime() > Date.now() - 8.64e6;//如果没有后面的-8.64e6就是不可以选择今天的
        }
      },  
      notificationPromise:Promise.resolve(),
      userPerson:'', //用户当前人
      department_name:'', //用户当前人所属部门
      dwmcValue: [], //部门下拉选项数据
      dialogVisible: false, //对话框 状态
      editdialogVisible: false, //对话框 状态
      temporaryTextarea: { //对话框值
      iframessrc:'',//下载模板
        row: "", //对象
        i: "", //索引
        type: "", //类型
      },
      options: { //下拉框 选项
        wtfxfs: [], //问题发现 下拉框值
        dwmc: [],//单位名称
        bmmc: [],//部门名称
        zylb: [],//
      },
      tableList: { //  表格标题数据
        title: {
          personName: "账号（提单人）", //账号（提单人）
          xh: "序号", //序号
          wtfxfs: "问题发现方式", //问题发现方式
          dwmc: "单位名称",
          bmmc: "部门名称",
          zylb: "专业类别",
          ywsx: "业务事项（考核载体）",
          wtms: "问题描述",
          gbyy: "根本原因",
          sscm: "所属层面",
          glhj: "管理环节",
          wtlb: "问题类别",
          dytxdy: "对应体系单元",
          dytxys: "对应体系要素",
          wtyzcd: "问题严重程度",
          sfslwt: "是否三老问题",
          sfzdbl: "是否主动暴露",
          zgjy: "整改建议",
          wtfxsj: "问题发现时间",
          wtfxr: "问题发现人",
          gdwkhbm: "各单位考核部门",
        },
      },
      FanhuiData:[],//提交到临时库返回的数组
      FanhuiDataZs:[],//提交到正式库返回的数组
      loading: false,//加载
      temloading:false,//临时列表加载
      typeBool: false, // 判断错误
      disabled:true,//按钮点击状态
      userInfo:{//添加信息
          personName: "", //账号（提单人）
          xh: "", //序号
          wtfxfs: "", //问题发现方式
          dwmc: "",
          bmmc: "",
          zylb: "",
          ywsx: "",
          wtms: "",
          gbyy: "",
          sscm: "",
          glhj: "",
          wtlb: "",
          dytxdy: "",
          dytxys: "",
          wtyzcd: "",
          sfslwt: "",
          sfzdbl: "",
          zgjy: "",
          wtfxsj: "",
          wtfxr: "",
          gdwkhbm: "",
          drman:"",
          fzr:"",
          instance_title:'手动录入',
          isover:'-1',
          datafrom:'手动录入',
      },
      editObj:{//编辑信息
          personName: "", //账号（提单人）
          xh: "", //序号
          wtfxfs: "", //问题发现方式
          dwmc: "",
          bmmc: "",
          zylb: "",
          ywsx: "",
          wtms: "",
          gbyy: "",
          sscm: "",
          glhj: "",
          wtlb: "",
          dytxdy: "",
          dytxys: "",
          wtyzcd: "",
          sfslwt: "",
          sfzdbl: "",
          zgjy: "",
          wtfxsj: "",
          wtfxr: "",
          gdwkhbm: "",
          drman:"",
          fzr:"",
          instance_title:'',
          isover:'',
          datafrom:'',
      },
      unserIndex: 0,//默认下标
      allTypemode:'',//类型：添加、编辑
      tableData: [], //列表数据
      checkAll: false,//多选框默认关闭
      isIndeterminate: true, //indeterminate 属性用以表示 checkbox 的不确定状态，一般用于实现全选的效果
      multipleSelection: [],//接收导出时复选框选中的数据
      multipleSelections:[],//临时数据
      linshimultipleSelection:[],//接收临时数据复选框选中的数据
      LookLsdata: false, //临时数据弹框显示
      Addtkdata: false, //添加数据弹框显示
      checkdwmc:dwmc,      //单位字段检查重复
      checkbmmc:bmmc,      //公司字段检查重复
      checkwtfxfs:wtfxfs,
      checkzylb:zylb,      
      checkywsx:ywsx,     
      checksscm:dwsscm,      
      checkglhj:glhj,      
      checkwtlb:wtlb,      
      checkdytxys:dytxys,      
      checkdytxdy:dytxdy,      
      checkwtyzcd:wtyzcd,
      checkgdwkhbm:gdwkhbm,     
      //使用messageId作为弹窗的key，用来获取弹窗的实例，以对对应弹窗进行操作
      notifications: [],      

    };
  },
  created() {
    //获取userid
    this.userPerson = this.$store.state.authInfo.user.userid
    console.log(this.userPerson)
    //获取当前人用户部门
    if(!this.$store.state.authInfo.user.rectify[0].department_path){
       this.department_name = '超高压输电公司/广州局/安全监管部测试'
    }else{
       this.department_name = this.$store.state.authInfo.user.rectify[0].department_path
    }
    this.options.wtfxfs = wtfxfs; //初始化下拉框 对应的值
    this.options.dwmc = dwmc;
    this.options.bmmc = bmmc;
    this.options.zylb = zylb;
    this.options.ywsx = ywsx;
    this.options.sscm = dwsscm;
    this.options.dytxys = dytxys;
    this.options.dytxdy = dytxdy;
    this.options.wtyzcd = wtyzcd;
    this.options.sfslwt = ["是", "否"];
    this.options.sfzdbl = ["是", "否"];
    this.options.gdwkhbm = gdwkhbm;
    this.options.glhj = glhj;
    this.options.wtlb = wtlb;
    // this.userInfo.drman = this.$store.state.authInfo.user.userid;
    // this.editObj.drman = this.$store.state.authInfo.user.userid;
    
      getThisIdList({ id: this.userPerson},this.loading = true ) //请求临时列表数据
      .then((res) => {
        this.loading = false
        //进来判断是否有数据
        if (res.data.retData != null) {
          //this.tableData = res.data.retData;
          this.multipleSelections = res.data.retData
        } else {
          this.$message({
            type: "warning",
            message: "当前没有录入数据,临时数据请点击打开查看",
          });
        }
      })
      .catch((err) => {
        
      });


  },
  methods: {
    //关闭所有通知
    closeAllNotification(){
      let _this = this;
      console.log(_this.notifications)
      for ( var key=0;key<_this.notifications.length;key++) {
        console.log(key)
        _this.notifications[key].close();
        delete _this.notifications[key];
      }
    },
    //点击跳转到错误行
    clickscrollPage(idx){
      console.log(idx)
      const PageId = document.querySelector('#page' + idx)
      PageId.scrollIntoView({behavior:'smooth',block:'center',inline:'start'})
    },
    //批量删除导入页面
  BatchDelete(){
    console.log(this.multipleSelection)
    let shanchu = false
    this.multipleSelection.forEach((item) => {
      var time1 = item.wtfxsj.toString()
      for(var i = 0; i<this.tableData.length;i++){
        //if(item.wtfxsj)
          var time2 = this.tableData[i].wtfxsj.toString()//编译时间
        //关键字段判断
        if (item.wtfxfs == this.tableData[i].wtfxfs && item.dwmc==this.tableData[i].dwmc && item.bmmc==this.tableData[i].bmmc && item.wtms==this.tableData[i].wtms && time1==time2) { 
            this.tableData.splice(i,1)
            shanchu = true
            break
        }
      } 
    })
    if(shanchu == true){
      this.$message({
        type: "success",
        message: "删除成功",
      }); 
    }
  },
  
  //批量删除临时数据表
    temporaryBatchDelete(){
    console.log(this.linshimultipleSelection)
   
    this.loading = true 
      batchdeleteList(this.linshimultipleSelection) //请求临时列表数据
      .then((res) => {
        this.loading = false
            if(res.data.retCode === "400"){
              this.linshimultipleSelection.forEach((item) => {
                var time1 = item.wtfxsj.toString()
                for(var i = 0; i<this.multipleSelections.length;i++){
                  //if(item.wtfxsj)
                    var time2 = this.multipleSelections[i].wtfxsj.toString()//编译时间
                  //关键字段判断
                  if (item.wtfxfs == this.multipleSelections[i].wtfxfs && item.dwmc==this.multipleSelections[i].dwmc && item.bmmc==this.multipleSelections[i].bmmc && item.wtms==this.multipleSelections[i].wtms && time1==time2) { 
                      this.multipleSelections.splice(i,1)
                      break
                  }
                } 
              })
              this.$message({
                type: "success",
                message: "删除成功",
              });
            }

      })
      .catch((err) => {
        
      });

  },


    //判断执行是添加还是编辑
    tableRowClassName(row,index,idx){
      this.allTypemode = idx
      switch(this.allTypemode){
        case "addUser":
          this.addUser()
          break;
        case "editUser":
          this.editUser(row,index)
          break;
      }
    },

    //添加信息
    addUser(){  
      this.userInfo.drman = this.userPerson //添加当前人部门字段
      console.log(this.userInfo.drman)
      this.userInfo.department_name = this.department_name //添加当前人部门字段
      console.log(this.userInfo.department_name)
      this.editdialogVisible = true
    },
    //确认添加信息
    addUserconFirm(){
      let temp = false
      if(!this.userInfo.dwmc || !this.userInfo.bmmc || !this.userInfo.zylb || !this.userInfo.ywsx || !this.userInfo.wtms || !this.userInfo.gbyy || !this.userInfo.sscm || !this.userInfo.glhj || !this.userInfo.wtlb || !this.userInfo.dytxdy || !this.userInfo.dytxys || !this.userInfo.wtyzcd || !this.userInfo.sfslwt || !this.userInfo.sfzdbl || !this.userInfo.zgjy || !this.userInfo.wtfxsj || !this.userInfo.wtfxr || !this.userInfo.gdwkhbm || !this.userInfo.wtfxr){
        temp = true
        this.$notify({
          title: '提示',
          message: `各字段不允许为空，请认真填写!`,
          duration: 0
        })
      }
      if(temp){
        return;
      }

  
      
      this.editdialogVisible = false
      this.tableData.push(this.userInfo);
      this.userInfo = {
        personName:"", //账号（提单人）
        xh:"", //序号
        wtfxfs:"", //问题发现方式
        dwmc:"",
        bmmc:"",
        zylb:"",
        ywsx:"",
        wtms:"",
        gbyy:"",
        sscm:"",
        glhj:"",
        wtlb:"",
        dytxdy:"",
        dytxys:"",
        wtyzcd:"",
        sfslwt:"",
        sfzdbl:"",
        zgjy:"",
        wtfxsj:"",
        wtfxr:"",
        gdwkhbm:"",
        fzr:"",
      }
      console.log(this.tableData)
      this.$message({
        type: "success",
        message: "添加成功",
      });
    },
    //编辑信息
    editUser(item,idx){
      this.unserIndex = idx
      this.editObj = {//编辑信息
          personName:item.personName, //账号（提单人）
          xh:item.xh, //序号
          wtfxfs:item.wtfxfs, //问题发现方式
          dwmc:item.dwmc,
          bmmc:item.bmmc,
          zylb:item.zylb,
          ywsx:item.ywsx,
          wtms:item.wtms,
          gbyy:item.gbyy,
          sscm:item.sscm,
          glhj:item.glhj,
          wtlb:item.wtlb,
          dytxdy:item.dytxdy,
          dytxys:item.dytxys,
          wtyzcd:item.wtyzcd,
          sfslwt:item.sfslwt,
          sfzdbl:item.sfzdbl,
          zgjy:item.zgjy,
          wtfxsj:item.wtfxsj,
          wtfxr:item.wtfxr,
          gdwkhbm:item.gdwkhbm,
          department_name:item.department_name,
          drman:item.drman,
          fzr:item.fzr,
          instance_title:item.instance_title,
          isover:item.isover,
          datafrom:item.datafrom,
      }
      this.editdialogVisible = true
    },
    //确认编辑信息
    editconFirm(){
      
      this.editdialogVisible = false
      //this.tableData[this.unserIndex] = this.editObj
      Vue.set(this.tableData,this.unserIndex,this.editObj)
      this.$message({
        type: "success",
        message: "编辑成功",
      });
    },
    //检查数据格式是否有重复和字段错误
    CheckAllData(data,i){
      this.loading = true
      var res;
      res = data
      console.log(res)
      var _this = this; //函数作用域问题
        for (var i = 0; i < res.length; i++) {
                      console.log(JSON.stringify(this.checkdwmc.toString()).indexOf(res[i].dwmc.toString()))
          var time1 = res[i].wtfxsj.toString()
            //字段是否规范       
            var Pdwmc = JSON.stringify(this.checkdwmc.toString()).indexOf(res[i].dwmc.toString())  
            var Pbmmc = JSON.stringify(this.checkbmmc.toString()).indexOf(res[i].bmmc.toString())  
            //var Pwtfxfs = JSON.stringify(this.checkwtfxfs.toString()).indexOf(res[i].wtfxfs.toString())  
            var Pzylb = JSON.stringify(this.checkzylb.toString()).indexOf(res[i].zylb.toString())  
            var Pywsx = JSON.stringify(this.checkywsx.toString()).indexOf(res[i].ywsx.toString())  
            var Psscm = JSON.stringify(this.checksscm.toString()).indexOf(res[i].sscm.toString())  
            var Pglhj = JSON.stringify(this.checkglhj.toString()).indexOf(res[i].glhj.toString())  
            var Pwtlb = JSON.stringify(this.checkwtlb.toString()).indexOf(res[i].wtlb.toString())  
            var Pdytxdy = JSON.stringify(this.checkdytxdy.toString()).indexOf(res[i].dytxdy.toString())  
            var Pdytxys = JSON.stringify(this.checkdytxys.toString()).indexOf(res[i].dytxys.toString())  
            var Pwtyzcd = JSON.stringify(this.checkwtyzcd.toString()).indexOf(res[i].wtyzcd.toString())  
            var Pgdwkhbm = JSON.stringify(this.checkgdwkhbm.toString()).indexOf(res[i].gdwkhbm.toString())  
            //  console.log(JSON.stringify(this.checkdwmc.toString()))
            //  console.log(res[i].dwmc.toString())
            let messagedata = 0;//排序
            let messagetitle = '';//错误内容

            if(Pdwmc == -1 || Pbmmc == -1 || Pzylb == -1 || Pywsx == -1 || Psscm == -1 || Pglhj == -1 || Pwtlb == -1 || Pdytxdy == -1 || Pdytxys == -1 || Pwtyzcd == -1 || Pgdwkhbm == -1){
              // if(Pdwmc == -1){
              //   messagetitle = '单位名称'
              // }else if(Pbmmc == -1){
              //   messagetitle = '部门名称'
              // }else if(Pzylb == -1){
              //   messagetitle = '专业类别'
              // }else if(Pywsx == -1){
              //   messagetitle = '业务事项（考核载体）'
              // }else if(Psscm == -1){
              //   messagetitle = '所属层面'
              // }else if(Pglhj == -1){
              //   messagetitle = '管理环节'
              // }else if(Pwtlb == -1){
              //   messagetitle = '问题类别'
              // }else if(Pdytxdy == -1){
              //   messagetitle = '对应体系单元'
              // }else if(Pdytxys == -1){
              //   messagetitle = '对应体系要素'
              // }else if(Pwtyzcd == -1){
              //   messagetitle = '问题严重程度'
              // }else if(Pgdwkhbm == -1){
              //   messagetitle = '各单位考核部门'
              // }
              messagetitle = Pdwmc == -1 ? '单位名称' : Pbmmc == -1 ? '部门名称' : Pzylb == -1 ? '专业类别' : Pywsx == -1 ? '业务事项（考核载体）' : Psscm == -1 ? '所属层面' : Pglhj == -1 ? '管理环节' : Pwtlb == -1 ? '问题类别' : Pdytxdy == -1 ? '对应体系单元' : Pdytxys == -1 ? '对应体系要素' : Pwtyzcd == -1 ? '问题严重程度' :  Pgdwkhbm  == -1 ? '各单位考核部门' : ''
                    //无这个字段
              res[i].pxxh = 'cuowu'
              messagedata = i + 1
                this.notificationPromise = this.notificationPromise.then(this.$nextTick).then(()=>{
                  let notify = this.$notify({
                  title: '提示',
                  dangerouslyUseHTMLString: true,
                  // message: `<strong @click="clickscrollPage(${i + 1})">第${i + 1}排序字段里有类型错误，请准确填写</strong>`,
                  duration: 0,
                  message: this.$createElement(
                    'div',
                    {},
                    [
                      this.$createElement('p', {messagedata}, [
                        this.$createElement('span', { style: { fontWeight: 'bold', color: 'red' },on: { click: () => {this.clickscrollPage(messagedata)} }  }, `第${messagedata}排序字段里'${messagetitle}'有类型错误，请准确填写`),
                      ]),
                    ]
                  ),
                //  onClick() {
                //    _this.clickscrollPage(messagedata); //自定义回调,message为传的参数
                //  }
                })
                //将messageId和通知实例放入字典中
                this.notifications.push(notify);
              })        
              this.loading = false
              this.typeBool = true
              // return;
            }

              this.typeBool = false
            for (var j = i + 1; j < res.length; j++) {
                var time2 = res[j].wtfxsj.toString()//编译时间
                //关键字段判断
                if (res[i].wtfxfs == res[j].wtfxfs && res[i].dwmc==res[j].dwmc && res[i].gbyy==res[j].gbyy && res[i].sscm==res[j].sscm && res[i].bmmc==res[j].bmmc && res[i].wtms==res[j].wtms && time1==time2) {          
                  //excel错误通知
                  res[i].chongfu = 'chongfu'
                  res[j].chongfu = 'chongfu'
                  this.$notify({
                    title: '提示',
                    dangerouslyUseHTMLString: true,
                    message: `<strong>第${i +1 }排序和第${j + 1}字段里有重复内容，请准确填写</strong>`,
                    duration: 0,
                  })
                  this.loading = false;
                  return;
                }else{
                  delete res[i].chongfu
                  delete res[j].chongfu
                }
            }
            this.tableData = res
        }

      setTimeout(() => {
        this.loading = false
      }, 500);
    },
    //修改时间戳
    formatDateTime(inputTime) {
    var date = new Date(inputTime);
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    m = m < 10 ? ('0' + m) : m;
    var d = date.getDate();
    d = d < 10 ? ('0' + d) : d;
    var h = date.getHours();
    h = h < 10 ? ('0' + h) : h;
    var minute = date.getMinutes();
    var second = date.getSeconds();
    minute = minute < 10 ? ('0' + minute) : minute;
    second = second < 10 ? ('0' + second) : second;
    return y + '-' + m + '-' + d+' '+h+':'+minute+':'+second;

//     function date2str(x,y) { 
//     var z = {M:x.getMonth()+1,d:x.getDate(),h:x.getHours(),m:x.getMinutes(),s:x.getSeconds()}; 
//     y = y.replace(/(M+|d+|h+|m+|s+)/g,function(v) {return ((v.length>1?"0":"")+eval('z.'+v.slice(-1))).slice(-2)}); 
//     return y.replace(/(y+)/g,function(v) {return x.getFullYear().toString().slice(-v.length)}); 
// } 
   },
    

    //修改导入数据
    Xgedit(row,index){
        console.log(row)
        this.$confirm('是否修改次行数据, 是否继续?', '提示', {
          confirmButtonText: '确定',  
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$message({
            type: 'success',
            message: '修改成功!'
          });
          var Pdwmc = JSON.stringify(this.checkdwmc.toString()).indexOf(row.dwmc.toString())  
          var Pbmmc = JSON.stringify(this.checkbmmc.toString()).indexOf(row.bmmc.toString())  
          //var Pwtfxfs = JSON.stringify(this.checkwtfxfs.toString()).indexOf(res[i].wtfxfs.toString())  
          var Pzylb = JSON.stringify(this.checkzylb.toString()).indexOf(row.zylb.toString())  
          var Pywsx = JSON.stringify(this.checkywsx.toString()).indexOf(row.ywsx.toString())  
          var Psscm = JSON.stringify(this.checksscm.toString()).indexOf(row.sscm.toString())  
          var Pglhj = JSON.stringify(this.checkglhj.toString()).indexOf(row.glhj.toString())  
          var Pwtlb = JSON.stringify(this.checkwtlb.toString()).indexOf(row.wtlb.toString())  
          var Pdytxdy = JSON.stringify(this.checkdytxdy.toString()).indexOf(row.dytxdy.toString())  
          var Pdytxys = JSON.stringify(this.checkdytxys.toString()).indexOf(row.dytxys.toString())  
          var Pwtyzcd = JSON.stringify(this.checkwtyzcd.toString()).indexOf(row.wtyzcd.toString())  
          var Pgdwkhbm = JSON.stringify(this.checkgdwkhbm.toString()).indexOf(row.gdwkhbm.toString()) 
          console.log(JSON.stringify(this.checkdwmc.toString()))
          console.log(row.dwmc.toString())
          // 判断字段是否错误
          if(Pdwmc == -1 || Pbmmc == -1 || Pzylb == -1 || Pywsx == -1 || Psscm == -1 || Pglhj == -1 || Pwtlb == -1 || Pdytxdy == -1 || Pdytxys == -1 || Pwtyzcd == -1 || Pgdwkhbm == -1){
              //无这个字段
              console.log(1)
              row.pxxh = 'cuowu'
              this.$notify({
                title: '提示',
                message: `当前排序字段里有类型错误，请准确填写`,
                duration: 0
              })
            }else{
              delete this.tableData[index].pxxh
          }

            var XgShuzu = []
            XgShuzu.push(row)
            this.tableData.splice(index, ...XgShuzu)
            console.log(this.tableData)

            //字段是否规范       

              delete this.tableData[index].chongfu
              delete this.tableData[index].isover
          
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消修改'
          });          
        });
    
    },
       //修改临时数据
    XgDaoruedit(row,index){

        this.$confirm('是否修改次行数据, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$message({
            type: 'success',
            message: '修改成功!'
          });

          var Pdwmc = JSON.stringify(this.checkdwmc.toString()).indexOf(row.dwmc.toString())  
          var Pbmmc = JSON.stringify(this.checkbmmc.toString()).indexOf(row.bmmc.toString())  
          var Pzylb = JSON.stringify(this.checkzylb.toString()).indexOf(row.zylb.toString())  
          var Pywsx = JSON.stringify(this.checkywsx.toString()).indexOf(row.ywsx.toString())  
          var Psscm = JSON.stringify(this.checksscm.toString()).indexOf(row.sscm.toString())  
          var Pglhj = JSON.stringify(this.checkglhj.toString()).indexOf(row.glhj.toString())  
          var Pwtlb = JSON.stringify(this.checkwtlb.toString()).indexOf(row.wtlb.toString())  
          var Pdytxdy = JSON.stringify(this.checkdytxdy.toString()).indexOf(row.dytxdy.toString())  
          var Pdytxys = JSON.stringify(this.checkdytxys.toString()).indexOf(row.dytxys.toString())  
          var Pwtyzcd = JSON.stringify(this.checkwtyzcd.toString()).indexOf(row.wtyzcd.toString())  
          var Pgdwkhbm = JSON.stringify(this.checkgdwkhbm.toString()).indexOf(row.gdwkhbm.toString()) 
          // console.log(JSON.stringify(this.checkdwmc.toString())) 
          // console.log(row.dwmc.toString()) 
          // console.log(JSON.stringify(this.checkdwmc.toString()).indexOf(row.dwmc.toString())) 
          // 判断字段是否错误
          if(Pdwmc == -1 || Pbmmc == -1 && Pzylb == -1 || Pywsx == -1 || Psscm == -1 || Pglhj == -1 || Pwtlb == -1 || Pdytxdy == -1 || Pdytxys == -1 || Pwtyzcd == -1 || Pgdwkhbm == -1){
              //无这个字段
              row.pxxh = 'cuowu'
              this.$notify({
                title: '提示',
                message: `当前排序字段里有类型错误，请准确填写`,
                duration: 0
              })
            }else{
              delete this.multipleSelections[index].pxxh
          }

            var XgShuzu = []
            XgShuzu.push(row)
            this.multipleSelections.splice(index, ...XgShuzu)
            console.log(this.multipleSelections)

            //字段是否规范       

              delete this.multipleSelections[index].chongfu
              delete this.multipleSelections[index].isover


            
            //console.log(row)
            //console.log(index)
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消修改'
          });          
        });
    
    },
    //删除excle表导入数据
    RemoveExceldata(row,index){
        this.$confirm('是否删除此数据, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
          }).then(() => {
            var indexs = index
            this.tableData.splice(indexs,1)
            console.log(this.tableData)
            this.$message({
              type: 'success',
              message: '删除成功!'
            });

          }).catch(() => {
            this.$message({
            type: 'info',
            message: '已取消删除'
          });          
        });


      
      
    },
    //删除临时数据库的数据
    Removedata(row,index){
      var id = row.id
      var Ros = row
       this.$confirm('是否删除此数据, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          var daid = id
          var rows = Ros
          var indexs = index
          deleteList({ id: daid }) //请求临时列表数据
          .then((res) => {
            console.log(indexs)
            console.log(res)
            this.multipleSelections.splice(indexs,1)
            console.log(this.multipleSelections)
          })
          .catch((err) => {
            console.log(err)
          });
        
          this.$message({
            type: 'success',
            message: '删除成功!'
          });
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });          
        });


      
      
    },
    //全选单选
    handleSelectionChange(rows,index) {
      console.log(rows)
      this.multipleSelection = rows;
      //this.select_order_number = this.multipleSelection.length;
      // this.selectArr = [];
      //   if (rows) {
      //     rows.forEach(row => {
      //       if (row) {
      //         this.selectArr.push(row.id);
      //       }
      //     });
      //   }
    },
      //临时数据弹框全选单选
    LinshiSelectionChange(rows,index){
      console.log(rows)
      this.linshimultipleSelection = rows;
    },
    checkboxT(row, index){
      if(row.is_use == 1){
        return 0;
      }else{
        return 1;
      }
    },
    //检查
    CheckFfdata(){


      console.log(this.tableData)
      let temp = false
      try{
        this.tableData.forEach((item,i) => {
          console.log(item.dwmc)
          if(item.personName === "" || item.xh === "" || item.dwmc === "" || item.bmmc === "" || item.zylb === "" || item.ywsx === "" || item.wtms === "" || item.gbyy === "" || item.sscm === "" || item.glhj === "" || item.wtlb === "" || item.dytxdy === "" || item.dytxys === "" || item.wtyzcd === "" || item.sfslwt === "" || item.sfzdbl === "" || item.zgjy === "" || item.wtfxsj === "" || item.wtfxr === "" || item.gdwkhbm === "" || item.wtfxr === "" || item.fzr === ""){
            temp = true
            this.$notify({
              title: '提示',
              message: `第${i +1 }排序各字段不允许为空，请准确填写`,
              duration: 0
            })
            throw new Error()
          }

        })
      }catch(err){
        // console.log(err)
      }


      if(temp){
        return;
      }
      this.closeAllNotification()
      this.CheckAllData(this.tableData)
      this.notifications = []
      if(this.typeBool){
        return
      }
      if(this.tableData.length == 0){
         this.$message({
              type: "error",
              message: "数据为空请填写",
            });
            return
      }

           var dindex = 0
          this.tableData.forEach((v,i) => {
            if(v.pxxh == undefined && v.chongfu == undefined ){
                dindex == 0
            }else{
                dindex ++
            }
          })
          //console.log(dindex)
          if(dindex >= 1){
            this.$message({
                type: "error",
                message: "有错误字段或者重复内容，请检查",
            });
            this.disabled = true
            return
          }else{
            this.tableData.forEach((item) => {
              delete item.pxxh
              delete item.chongfu
            })
            this.disabled = false
            this.$message({
              type: "success",
              message: "检查完毕",
            });

          }

      
      

    },
    //保存到临时库
    AllDialogsaveData(){ 
      this.loading = true     
      this.temloading = true
      console.log(this.multipleSelection)
      if(this.multipleSelection.length === 0){
         this.$message({
            type: "warning",
            message: "请勾选要上传的数据",
          });
          this.loading = false
      }else{
        uploadtemporary(this.multipleSelection).then(res => {
          this.loading = false
          this.temloading = false

          if(res.data.retCode === "0000"){
            this.FanhuiData = res.data.retData
            this.FanhuiData.forEach((item) => {
              var time1 = item.wtfxsj.toString()
              for(var i = 0; i<this.tableData.length;i++){
                //if(item.wtfxsj)
                  var time2 = this.tableData[i].wtfxsj.toString()//编译时间
                //关键字段判断
                console.log(item.dwmc)
                console.log(this.tableData[i].dwmc)
                if(item.isover == "1"){
                  if (item.wtfxfs == this.tableData[i].wtfxfs && item.dwmc==this.tableData[i].dwmc && item.bmmc==this.tableData[i].bmmc && item.wtms==this.tableData[i].wtms && time1==time2) {                  
                    this.tableData[i].isover = "1"
                    break
                  }
                }
               
              }            
            })


           this.$message({
              type: "error",
              message: "导入数据与临时数据重复，请检查",
            });
            this.disabled = true
            return
          }
          // if(res.data.retCode === "4444"){
          //    this.$message({
          //     type: "error",
          //     message: "您还有未处理的临时数据，请尽快处理",
          //   });
          //   return
          // }

          if(res.data.retCode === "400"){
            this.LookLsdata = true
            this.FanhuiData = res.data.retData
            this.multipleSelections = []
            console.log(this.FanhuiData)
            this.FanhuiData.forEach((item) => {
              var time1 = item.wtfxsj.toString()
              for(var i = 0; i<this.tableData.length;i++){
                //if(item.wtfxsj)
                  var time2 = this.tableData[i].wtfxsj.toString()//编译时间
                //关键字段判断
                if (item.wtfxfs == this.tableData[i].wtfxfs && item.dwmc==this.tableData[i].dwmc && item.bmmc==this.tableData[i].bmmc && item.wtms==this.tableData[i].wtms && time1==time2) { 
                    this.tableData.splice(i,1)
                    break
                }
              } 
              this.multipleSelections.push(item)
            })

            console.log(this.multipleSelections)
             this.$message({
              type: "success",
              message: "上传临时库成功",
            });
          }



        }).catch( err => {
          console.log(err)
        })

      }
    },
    //提交到正式库
    SendData(){
      this.loading = true
       if(this.linshimultipleSelection.length === 0){
         this.$message({
            type: "warning",
            message: "请勾选要上传的数据",
          });
          this.loading = false
      }else{

        uploadformal(this.linshimultipleSelection).then(res => {
          this.loading = false
          if(res.data.retCode === "0000"){
            this.FanhuiDataZs = res.data.retData
            this.FanhuiDataZs.forEach((item) => {
              var time1 = item.wtfxsj.toString()
                          console.log(this.multipleSelections)
              for(var i = 0; i<this.multipleSelections.length;i++){
                  console.log(111)
                  var time2 = this.multipleSelections[i].wtfxsj.toString()//编译时间
                //关键字段判断
                console.log(item.dwmc)
                console.log(this.multipleSelections[i].dwmc)
                if(item.isover == "1"){
                     console.log(222)
                  if (item.wtfxfs == this.multipleSelections[i].wtfxfs && item.dwmc==this.multipleSelections[i].dwmc && item.bmmc==this.multipleSelections[i].bmmc && item.wtms==this.multipleSelections[i].wtms && time1==time2) {                  
                    this.multipleSelections[i].isover = "1"
                    break
                  }
                }
               
              }            
            })
            this.$message({
              type: "error",
              message: "临时数据插入正式数据库失败，含有重复问题",
            });

          }

          if(res.data.retCode === "3333"){
              this.$message({
              type: "error",
              message: "警告，只能插入临时数据存在的数据！",
            });
            return
          }

          if(res.data.retcode === "4444"){
             this.$message({
              type: "error",
              message: "您还有未处理的临时数据，请尽快处理",
            });
            return
          }
          if(res.data.retCode === "400"){
              this.linshimultipleSelection.forEach((item) => {
              var time1 = item.wtfxsj.toString()
              for(var i = 0; i<this.multipleSelections.length;i++){
                //if(item.wtfxsj)
                  var time2 = this.multipleSelections[i].wtfxsj.toString()//编译时间
                //关键字段判断
                if (item.wtfxfs == this.multipleSelections[i].wtfxfs && item.dwmc==this.multipleSelections[i].dwmc && item.bmmc==this.multipleSelections[i].bmmc && item.wtms==this.multipleSelections[i].wtms && time1==time2) { 
                    this.multipleSelections.splice(i,1)
                    break
                }
              }            
            })

            this.$message({
              type: "success",
              message: "临时数据插入正式数据库成功",
            });
            this.$confirm('问题将发送至安监部（注："公司层面的发送到公司安监部"，"非公司层面发送到单位所属的安监部"）', '须知', {
              confirmButtonText: '了解',
              type: 'warning'
            })
          
          }
          console.log(res)

        }).catch( err => {
          console.log(err)
        })

      }
      this.disabled = true

    },

    // changeGlhjWtlb(event, scope) { //把管理环节 和 问题类别的 多选项目 解析成 字符串
    
    //   let d = ""; 
    //   for (let i = 0; i < event.length; i++) {
    //     d += event[i] + ",";
    //   }
    //   switch(scope.column.label){
    //     case '管理环节': 
    //     this.tableData[scope.$index].glhjv = d;
    //     break;
    //     case '问题类别': 
    //     this.tableData[scope.$index].wtlbv = d;
    //     break;   
    //   }

    // },
    // changeSelectValue(e) { //单位名称选项跟 部门名称值 下拉框的绑定
    // this.dwmcValue = this.options.dwmc[e];
    // },
    // ChangeDwmc(val, scope) { //改变 改变对应要素的值
    //   const s = scope;
    //   let d = "";
    //   for (let i = 0; i < val.length; i++) {
    //     d += val[i];
    //     if (i < val.length - 1) {
    //       d += "->";
    //     }
    //   }
    //   switch (scope.column.property) {
    //     case "dytxdy":
    //       this.tableData[s.$index].dytxys = d;
    //       break;
    //   }
    // },
    // openDialog(scope) { //打开对话 窗口 并传递 值 
    //   //打开输入框
    //   const s = scope;
    //   switch (scope.column.property) {
    //     case "wtms":
    //       this.temporaryTextarea.row = s.row.wtms;
    //       break;

    //     case "gbyy":
    //       this.temporaryTextarea.row = s.row.gbyy;
    //       break;

    //     case "zgjy":
    //       this.temporaryTextarea.row = s.row.zgjy;
    //       break;
    //   }

    //   this.temporaryTextarea.type = s.column.property;
    //   this.temporaryTextarea.i = s.$index; //索引
    //   this.dialogVisible = true;
    // },
    // DialogsaveData(row) { //关闭对话 窗口 保存值到对应 栏目  
    //   const s = this.temporaryTextarea;
    //   switch (s.type) {
    //     case "wtms":
    //       this.tableData[s.i].wtms = s.row;
    //       break;
    //     case "gbyy":
    //       this.tableData[s.i].gbyy = s.row;
    //       break;
    //     case "zgjy":
    //       this.tableData[s.i].zgjy = s.row;
    //       break;
    //   }
    //   this.dialogVisible = false;
    // },
    uploadExcel(file, fileList) { //判断上传的的文件是否符合要求
      this.disabled = true
      this.fileTemp = file.raw;
      if (this.fileTemp) {
        if (
          this.fileTemp.type ==
            "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ||
          this.fileTemp.type == "application/vnd.ms-excel"
        ) {
          

          console.log(this.loading = true)
          this.importfxx(this.fileTemp); //附和要求 调用解析excel函数
        } else {
          this.$message({
            type: "warning",
            message: "附件格式错误，请删除后重新上传！",
          });
        }
      } else {
        this.$message({
          type: "warning",
          message: "请上传附件！",
        });
      }
    },
    importfxx(obj) { //excel解析
    this.loading = true
      let file = new Promise((resolve, reject) => {
        var rABS = false; //是否将文件读取为二进制字符串
        var f = obj; //数据对象
        var reader = new FileReader();
        reader._this = this;
        FileReader.prototype.readAsBinaryString = function (f) {
          var binary = "";
          var rABS = false; //是否将文件读取为二进制字符串
          var wb; //读取完成的数据
          var outdata;

          reader.onload = function (e) {
            var bytes = new Uint8Array(reader.result);
            var length = bytes.byteLength;
            for (var i = 0; i < length; i++) {
              binary += String.fromCharCode(bytes[i]);
            }
            var XLSX = require("xlsx"); //引入解析excel插件
            if (rABS) {
              wb = XLSX.read(btoa(fixdata(binary)), {
                //手动转化
                type: "base64",
              });
            } else {
              wb = XLSX.read(binary, {
                type: "binary",
                cellDates: true,
              });
            }
            let arr = [];
            outdata = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]); //outdata就是你想要的东西
            try{
              [...outdata].map((v) => {
                let _data = reader._this._data; // this.data 里面的值
                let obj = {};
                  obj.personName = v["账号（提单人）"] || "",
                  obj.xh = v["序号"] === undefined ? _data.tableData.length + 1: v["序号"], //防止导入excel 里面序号没有值
                  obj.wtfxfs = v["问题发现方式"] || "",
                  obj.dwmc = v["单位名称"] || "",
                  obj.bmmc = v["部门名称"] || "",
                  obj.zylb = v["专业类别"] || "",
                  obj.ywsx = v["业务事项（考核载体）"] || "",
                  obj.wtms = v["问题描述"] || "",
                  obj.gbyy = v["根本原因"] || "",
                  obj.sscm = v["所属层面"] || "",
                  obj.glhj = v["管理环节"] || "",
                  obj.wtlb = v["问题类别"] || "",
                  obj.dytxdy = v["对应体系单元"] || "",
                  obj.dytxys = v["对应体系要素"] || "",
                  obj.wtyzcd = v["问题严重程度"] || "",
                  obj.sfslwt = v["是否三老问题"] || "",
                  obj.sfzdbl = v["是否主动暴露"] || "",
                  obj.zgjy = v["整改建议"] || "",
                  obj.wtfxsj = v["问题发现时间"] || "",
                  obj.wtfxr = v["问题发现人"] || "",
                  obj.gdwkhbm = v["各单位考核部门"] || "";
                  obj.fzr = v["问题责任人"] || "";
                  obj.department_name = this.department_name || "", //获取的部门("超高压输电公司/广州局/安全监管部")
                  obj.drman = this.userPerson,   //获取userid
                  obj.instance_title = "Excel导入表单:" + f.name, //导入excel文件的 文件名称
                  //obj.createa_time = "单位自查", //单位自查 公司自查
                  obj.isover = "-1", //流程是否结束
                  obj.datafrom = "Excel导入表单"; //导入文件类型
                  if(!(v.hasOwnProperty(["各单位考核部门"]))){
                    console.log(v['各单位考核部门'])
                    throw new Error()
                  }
              arr.push(obj);  

              
              
            });
            }catch(err){
              alert('此模板不是单位模板，请核对！')
              console.log(err)
            }
            
            resolve(arr);
          };
          reader.readAsArrayBuffer(f);
        };
        if (rABS) {
          reader.readAsArrayBuffer(f);
        } else {
          reader.readAsBinaryString(f);
        }
      });

      file.then((res) => { //excel解析成对象完毕     
      //判断Excel是否重复
      //this.CheckAllData(res)
          //创建时间格式化显示


        res.forEach((v,i) => {

          v.zylb = v.zylb.replace(/\s*/g,'')
          v.ywsx = v.ywsx.replace(/\s*/g,'')
          v.glhj = v.glhj.replace(/\s*/g,'')
          v.wtlb = v.wtlb.replace(/\s*/g,'')
          v.wtfxsj = v.wtfxsj = this.formatDateTime(v.wtfxsj).slice(0,10)   // 去掉时间，保留日期
          v.drman = this.userPerson //当前人
          v.department_name = this.department_name  //当前人所属部门
          this.tableData.push(v) 
          // this.tableData[i].wtfxsj = this.formatDateTime(v.wtfxsj)
           console.log(this.tableData)
        });
      setTimeout(() => {
          this.loading = false
      }, 1000);

      });
    },
    handleRemove(file, fileList) {      //清空列表数据
      this.fileTemp = null;
      this.tableData = [];
    },
    doBack() {
      this.$router.back();
    },

  },
};
</script>

<style scoped lang="less">
.baocuohong.org{
  background: greenyellow;
  color:white;
  border-radius: 50%;
}
.baocuohong.red{
  background: red;
  color:white;
    border-radius: 50%;
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
}

  .main-table::v-deep .cell{
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
  }
//  /deep/.cell {
//     overflow: hidden;
//     text-overflow: ellipsis;
//     display: -webkit-box;
//     -webkit-line-clamp: 2;
//     -webkit-box-orient: vertical;
//   }
.etable th {
  padding: 10px 0 !important;
}
.etable td {
  padding: 6px 0 !important;
}

// .body{
// width: 100vw;
// height: 100vh;

.main {
  background: #eff3f8;
  padding: 40px;
  height: 100vh;
  .main-menu {
    .col {
      display: flex;
      justify-content: flex-end;
      padding: 20px;
    }
    background: #ffffff;
  }
  .main-table {
    margin-top: 20px;
  }
  .main-submit {
    margin-top: 15px;
  }
}
.demo-form-inline{
  overflow-y: auto;
  white-space: nowrap;
}
/deep/.cell {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    height: 42.4px;
  }
  .topbutton{
  margin-right:10px;margin-bottom:10px;display:inline-block;
}
 /deep/.el-checkbox__input.is-disabled .el-checkbox__inner{
    border: 1px solid red;
  }
  /deep/.el-checkbox__inner{
    border: 1px solid red;
  }
  .multiplposition{
    // position: absolute;
    // top: 0;
    // left:0;
    color: red;
  }
  .maincontainer{
    background: white;
    border-radius: 10px;
    float: left;
    width: 100%;
    overflow: hidden;
  }
// }
</style>
